package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.mapper.CommentReplyMapper;
import cn.wolfcode.trip.base.mapper.MessageMapper;
import cn.wolfcode.trip.base.mapper.SystemNoticeMapper;
import cn.wolfcode.trip.base.mapper.UpvokeMapper;
import cn.wolfcode.trip.base.service.IMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MessageServiceImpl implements IMessageService {

    @Autowired
    private UpvokeMapper upvokeMapper;
    @Autowired
    private CommentReplyMapper commentReplyMapper;
    @Autowired
    private MessageMapper messageMapper;//私信
    @Autowired
    private SystemNoticeMapper systemNoticeMapper;
    @Override
    public Integer countUpvokeNum(Long userId) {
        //点赞数
        Integer invokeNum=upvokeMapper.selectForCountByUserId(userId);
        return invokeNum;
    }

    @Override
    public Integer countCommentNum(Long userId) {
        //评论数
        Integer commentNum = commentReplyMapper.selectForCountByUserId(userId);
        return commentNum;
    }

    @Override
    public Integer countLetterNum(Long userId) {
        //私信数
        Integer letterNum=messageMapper.selectForCountByUserId(userId);
        return letterNum;
    }

    @Override
    public Integer countNoticeNum(Long userId) {
        //通知数
        Integer noticeNum=systemNoticeMapper.selectForCount(userId);
        return noticeNum;
    }
}
